﻿/**
 *
 * @file FITKAFLRMesherDriver.h
 * @brief  网格划分驱动器声明
 * @author WangKai (aurora_starry@outlook.com)
 * @date 2024-07-18
 *
 */
#ifndef __FITK_AFLR_DRIVER_OF_H___
#define __FITK_AFLR_DRIVER_OF_H___

#include "FITK_Interface/FITKInterfaceMeshGen/FITKAbstractMesherDriver.h"

namespace Interface {
	class FITKMeshGenInterface;
	class FITKAbsGeoCommand;
	class FITKVirtualTopoManager;
	class FITKGeometryMeshVS;
}

namespace AFLR
{
	class FITKAFLRSurfaceMeshModel;
    /**
     * @brief 网格划分驱动器
     * @author WangKai (aurora_starry@outlook.com)
     * @date 2024-07-18
     */
    class  FITKAFLRMesherDriver : public Interface::FITKAbstractMesherDriver
    {
        Q_OBJECT
    public:
        /**
         * @brief Construct a new FITKAFLRMesherDriver object
         * @author WangKai (aurora_starry@outlook.com)
         * @date 2024-07-18
         */
        explicit FITKAFLRMesherDriver() = default;
        /**
         * @brief Destroy the FITKAFLRMesherDriver object
         * @author WangKai (aurora_starry@outlook.com)
         * @date 2024-07-18
         */
        virtual ~FITKAFLRMesherDriver() = default;
        /**
         * @brief 启动网格划分程序
         * @param[i]  info           附加信息
         * @author WangKai (aurora_starry@outlook.com)
         * @date 2024-07-18
         */
        virtual void startMesher(QStringList info = QStringList()) override;
        /**
         * @brief 结束网格划分程序
         * @param[i]  info           附加信息
         * @author WangKai (aurora_starry@outlook.com)
         * @date 2024-07-18
         */
        virtual void stopMesher(QStringList info = QStringList()) override; 

		/**
		 * @brief 面网格划分驱动
		 * @author WangKai (aurora_starry@outlook.com)
		 * @date 2024-09-07
		 */
		void startSurfaceMeshing();
    public slots:
		/**
		 * @brief 体网格划分驱动
		 * @author WangKai (aurora_starry@outlook.com)
		 * @date 2024-09-07
		 */
		void startVolumeMeshing();

		/**
		 * @brief 网格格式文件转换
		 * @author WangKai (aurora_starry@outlook.com)
		 * @date 2024-09-07
		 */
		void startConversion();


    protected:
    private:
		/**
		 * @brief 合并写STL文件
		 * @params fileName
		 * @return  
		 * @author WangKai (aurora_starry@outlook.com)
		 * @date 2024-09-07
		 */
		bool writeSTL(QString fileName);

		//bool newWriteSTL(QString fileName);

		/**
		 * @brief 设置面的ID
		 * @params modelID
		 * @params faceGroupID
		 * @return WangKai (aurora_starry@outlook.com) 
		 * @author 
		 * @date 2024-09-07
		 */
		QString setFaceID(int modelID, int faceGroupID);
		/**
		 * @brief 格式化面ID参数
		 * @params faceIDs
		 * @params encryptionFactor
		 * @return WangKai (aurora_starry@outlook.com) 
		 * @author 
		 * @date 2024-09-07
		 */
		QString generaterRefinementFactors(const QString& faceIDs, double encryptionFactor);

		/**
		 * @brief 删除指定后缀类型的文件
		 * @params folderPath
		 * @params extensions
		 * @author WangKai (aurora_starry@outlook.com) 
		 * @date 2024-09-07
		 */
		void removeFilesByExtension(const QString &folderPath, const QStringList &extensions);
		
		/**
		 * @brief 检查是否存在特定类型的文件
		 * @params fileName
		 * @return  
		 * @author WangKai (aurora_starry@outlook.com) 
		 * @date 2024-09-07
		 */
		bool checkFileAndExecute(const QString &fileName);

	private:
		Interface::FITKMeshGenInterface* _mf = nullptr;
		/**
		 * @brief 网格划分参数数据结构
		 * @date 2024-09-07
		 */
		FITKAFLRSurfaceMeshModel* _surfaceMeshModel = nullptr;

		QString _stlFile {};
		QString _stpFile{};
		QString _surfFile{};
		QString _urgidFile{};
		QString _foamFile{};
		


    };
}


#endif
